Skip to content

feat(pool): the share switch runs the node agent, on Windows in WSL2 (ADR-0113) - #580

Merged
7schmiede merged 2 commits into
mainfrom
feat/share-switch-node
Nov 18, 2026
Merged

7schmiede merged 2 commits into
mainfrom
feat/share-switch-node

Conversation

@7schmiede

Copy link
Copy Markdown
Member

The share switch is back and makes the machine a node: on Linux the hub runs the node agent itself, on Windows it runs it in a WSL2 distribution with a copy of the machine's membership. Builds on the WSL2 spike of #168 (result in #168). Closes #171.

Review card

Approved by the owner in the conversation on 2026-11-18, points 1 to 5.

# Category Point Beats Reversing costs
1 concept The share switch makes the machine a node: on Linux the agent runs in the hub, on Windows the hub starts it in a WSL2 distribution (wsl.exe -d <distro> -u root -- devstack node agent …), starts it again when it ends, and ends it when switched off. Docker-in-Docker (#168); an agent in a terminal window Medium
2 concept The agent in WSL serves the machine's membership, read from the Windows side: one member per machine; while it runs, the hub does not report (#170). Two members per machine (the spike) Medium
3 trust The hub does not set the distribution up: it checks it and shows what is missing, as commands and as a prompt for a coding agent; elevation and wsl --shutdown stay with the user. A hub that installs packages and ends Docker Desktop Low
4 contract Caps come from the switch and stay below what .wslconfig gives WSL; never --dedicated. Caps above the VM's memory Low
5 contract Off means no new lanes; running lanes go on until their owners stop them, and the switch shows how many still run. Ending running lanes at once Low

Decided while building (in ADR-0113): the prompt is copied from the switch, not handed to an agent the hub starts; point 4 holds by construction (the agent measures inside the VM); the switch's agent takes no admin-ordered update (on_update: None); one switch and port per pool (default 4261); macOS says "not yet"; the switch lives in node-host.json, so an old share.json with enabled does not start an agent.

Changes

  • crates/devstack-hub/src/nodehost.rs (new): the switch, the supervisor (decide: start, restart, drain, stop), Linux in-process agent, Windows: distribution list, checks, membership copy into /var/lib/devstack-node/<pool>, agent via wsl.exe, setup prompt.
  • share.rs: GET carries switch and host, PUT saves and acts; no hub report while its agent runs.
  • devstack node agent --membership <dir> --no-new-lanes; the node's report says sharing from its settings.
  • Dashboard: ShareSwitch.vue in the sidebar and Pool → This machine (distribution, caps, state, checks with copyable commands, prompt, last lines).
  • Docs: ADR-0113, ADR-0031 status, pool.md (the share switch), dashboard-api.md, SECURITY.md, changelog.

Tests

  • Unit: the step from switch to agent, the agent's arguments, impossible switches, an old share.json, the WSL list in UTF-16, the distribution's checks and prompt, the address toward the coordinator.
  • API: GET/PUT /hub/pool/share without a membership.
  • Dashboard: ShareSwitch.test.ts (checks, draining, waiting for a grant, the switch sent with the distribution); typecheck, 287 tests.
  • cargo clippy --workspace --all-targets, cargo test --workspace green on Windows. The Linux in-process path is compiled by CI only (no cross compiler here).
  • Not yet run on a Windows machine with WSL: the spike's machine is next, after the release.

🤖 Generated with Claude Code

7schmiede and others added 2 commits November 18, 2026 18:05
…(ADR-0113)

The hub runs a node agent for each pool whose switch is on: on Linux
inside the hub, on Windows in a WSL2 distribution with a copy of the
machine's membership (one member per machine). It checks the
distribution and shows what is missing with commands and a setup prompt,
never changing it itself. Off while others' lanes run, the agent takes
no new lanes (--no-new-lanes) and ends with the last. The node reports
`sharing` from its settings. Closes #171.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The share switch makes the machine a node: it runs the node agent (Linux in the hub, Windows via #168)

1 participant